changed all occurances of debugTree to record