rebuilding javascript codebase in an MVC architecture