refactored kernel