Refactor generator based on the new schema grammar