refactor synthesis engine