added a logout button, undelegate events