created functions to help with the login procedure