TransitionRules made into template, big mess fixed