Added conditional checking if user is already logged in.