Changes to log in logic