Added checkIfLoggedIn funcionality