Integrated the new version of the reduceTo method into  the main algorithm