Added resampling functions