Reduce duplication in message formatting