Adding in logic to handle the login state a little better