constructing a tree map