Some code clean-up in controller.
Moved some code that wires up handlers to controller.js.