add resample and smooth func