modifying grammar to break processing out into more granular and managed steps