fix #862 create a visitor pattern to traverse the mapping in a nicer fashion