Mechanics code optimizations/