Added support for kernel density estimation in addition to gaussian density