The beginnings of implementing the engine struct. Still lots of work to do. The ordering is messy, initialisation doesn't work and there's nasty hacks to push the callbacks in there.