add tests for RuleBook, refactor helper functions for rules, add a flag to swtich between old and new RuleBook API