chat logic update