Moved kernel into a cpp file