partial refactoring to avoid matching a message twice
not using get-pretty-message anymore, but can't delete yet because it's used in tests