Updated with all current functions
Slight modifications due to code changes
Fixed convexity, slight formula changes