I am confused what this foldl is doing. Custom is a list of key/value pairs, CV starts as an empty list into which you are putting the key/value pairs of Custom...aren't you just re-creating Custom, but in reverse order?