Refactor into modules using RequireJS