refactored for RequireJS