code through 9.13 added for login func