Added STDIN fix. Now accepting either file or STDIN input