Implement r.js optimization