Using for in instead of array::map