getting rid of weird discontinuities