More controller.js optimizations