abstract `map` better

**please review** @dwightguth, @osa1