implemented an efficient traverse.