Move loggedIn code