Added affine-trend removal