added the login function