Updated formatting of routes file.
Renamed local variable. Added some documentation.
Centralised program logic in habit so that controllers are very thin.