more work towards engine rewrite