How about making this an anonymous function inside traverseBookmarks, for readability