Refactor to help resolve requirejs dependency issues in cms