Further reworking of the engine. The State Manager has been updated mostly.