Now handle all files instead of just first one.

Add a loop. Use let instead of var to keep variables within scope of loop,
preventing them from being reset on next iteration.