Fixes #7. Pulled grammar retriever into util class.