Shuffling code around to manage login in one main contrailler