add segments and smoothing