Cleanup and formatting for calculus