many changes; add new kernelDistance