refactor engine, add some test