improved the ChatServer class and added comments