finished fix to make work on one file at a time