Changed to work with n input files
Removed comments