refactor ast conversion