minor changes and cleanup
replace group/groupchain with a rule system
Merge branch 'group-rewrite'