cleaned up session tracking and login procedure