infile: refactoring