Added loggedIn boolean check