Kernel refactoring phase 1