mostly working generic grammar