use map instead of loop for iteration