Re-added recursion for unlimited number of tree levels