1. Centralise the logic for getting the filename for a DIE.
2. Use the form of logic suggested by Philippe Ombredanne (thanks!).
Merge pull request #16 from ShaheedHaque/filenames2

Centralise the logic for getting the filename for a DIE.