Resampling refactoring