added chat function