refactored to requirejs