Tree now works. will need more work to handle the closed case