implemented chat backend