Added simple resampling routine.