still stuff wrong...but have all the logic in there for tree