Move declaration of kernel to the beginning of the method