Added pair-fn to transform both key and value