consolidate tree functions in tree.py
rename functions in rules.tree