Math library cleaned up a bit