Reworked engine to be simplier.