first working KCSD3D, minor changes in 1D, 2D