Optimization and formatting