Correctly handle files passed through the command line