cleaning up grammar terminal insertion