refactor build engine