Replace loop with map.