Script for processing in several steps, avoiding memory overflow.