couldn't we simply use rule.keys.collect vs creating rule_keys variable?