New script added with resampling method