Implement traverseWithKey