Cleaned up log-out code