adding new logic for checkIfUserLoggedIn