cleaning up math code
cleaning up math code