Optimization and code review #2