traverse function complete