Appkernel refactoring