changed map to a forEach instead of for loop