Massive kernel rewrite to introduce OOP