message handling and text replacement