adding PDF filename to download link where possible, cleaned up a bit wi...

...th regular expressions as well