Rewrite in python; use a process pool; number saved files.