Refactors Model code to use requirejs define methods.