Another pretty good rewrite of the Engine