added trimming to resampling
test cases for trimming