finished tree view refactor