refactored for requirejs