further refining login functions