switch from left and right child to an array of links