Refactor method treeDelete. Looks much simplyer now.