finished the login() function in this version.