added LogoutServlet, small fixes and refactoring