cleaned up controller.js