develop basic chat function