created login/logout logic