Properly handles file names ending in a space.
Does more pull-review clean-ups