Chat refactor