consolidated two onChat listeners into one