Changed from readlines() to fileinput for large files