Added code to generate candidates and rules, output