use only inorder map, much conciser code