refactored parse to use the def tree