use array intead of tree_map