Almost done, todo: fix tree