Optimization

some optimization work