Kind of got the rule generation working