Added logic for tree map.