Refactored trigonometry and exponential functions