Implement map and mapSeries
Remove duplication between map and mapSeries