Refactor by turegjorup: Evil kernel hack removed, DI used instead