Remove some minor code duplication and add a bit more compatibility with Windows
Fix a bug with the tidying up
Refactor the code a little bit
Extend the tests
Fix the lint warning
Merge pull request #380 from peternewman/trivial-fixes

Improve some of the path to filename code