Move top-level stuff to the top-level
Remove checkLoggedIn function on MainCtrl

Instead this is now called from app.run() so that it is unconditionally
run when the application is started.
We have no need to init the MainCtrl anymore
Clean up debug log messages.
Stop routing if the user has not been checked yet