Introduce functional style implementation in kernel