Much simpler map() implementation