Tweaking script to handle filenames with whitespace