major refactor of tree and node models