switched keys.toSet to keySet