Improved minimization. Still needs work.