refactoring and continued implementation of gradients for degenerate kernels