completed chat function