Some more refactoring
Adding Resampling tests