Updated kernel for Matlab wrapper