skeleton of multiprocessing
make the core routine more modular in preparation for multiprocessing
incidentally, it has changed the gold results