Cleaned up environments and add more math
Simplified some built-in functions.