Fixed logout button if authenticated user tries to log in or register.
Still trying to digest this code.