Fix typo in comment
A bit of coding style improvement
Rewrite a piece of logic from parseFilename()