cleanup and added math functions (a ton of them)