add untested generateTree method