Magnetic calculations now working