added chat messages, some optimizations