Various engine logic fixes.
Engine low level tests added.