processing according to spec; sort of
split pair; null pair item not handled
null values handled
some formatting; not necessary