Star Formation With Adaptive Mesh Refinement And Magnetohydrodynamics