Changes on AuthenticateUser function