relocate login and register functions