Modify 'Chat Function #3'

Rewrote /most/ of #3. Made it cleaner, more maintainable and smaller.