rewrite parameter parsing so options can come in any order
Shows name of file on error