Refactoring and Bug fixing for Chat and Servlet