in resampling: made changes to resampling agorithm per Diaz's clarification.