Changed for loop for map