Changes to login function