Added a helper class and implemented the kernel function