formatMessage method added