Rewrote chat hook code.