updated resampling method