Refactored resampling tool.