cleaned up login/logout functions