Fixed some divide by zero and using a magnitude as a vector because I am a genius