begins rewrite of controllers.js