Improve filename parsing
Merge pull request #2 from vannell/master

Improve filename parsing
Works well, thanks a lot.