Refactor engine reconciler and add tests!