Improve robustness and add ability to parse single file argument