Phase I: adjusted the kv to vk process to use iteritems() and a defaultdict