Pass in unobfuscated document name to messages
Attempt to refactor out some complexity