added helper function to check if logged in