updated to run on multiple files