refactor and monkey patch Kernel
resolve merge conflict