code cleanup and a small chat system inclued