added method to add an object to the tree