Added a check for the tree parameter in the init() method to  assess in the parameter is the tree or the treeview