Typos
Added map and match functions so 'sum' can be generic