Refactor to support streams of filenames