added client side resampling