make match/rewrite rules into nested classes