Made update to login function