Optimization refactoring.