Properly replace chat. Hardcoding never helped anyone.

Fixes issue #30.
Use ternaries where possible.