implement the kernel method