Refactor Chat