code review - use map instead of reduce