cleaned up code in ChatLogging