add func arg to traverse func
traverse also record the key and add sorted traverse