Scripts for resampling() and Honorio-Samaras algo.