major refactor in the tree structure and field variables