Adds to_tree_cpd method to RuleCPD class and some minor bug fixes