Changed the logout mechanism to be in the main controller