Move init outside kernel
Simplify some code