Replaced loops over lines of input files with shutil.copyfileobj to prevent uncontrolled memory consumption
new files
merged with master