Use KernelDensity. Fixes #301, fixes #361.