Added a check to see if there's a user logged in in the first place