this should be .foreach. You are doing a side effect. .map may be lazy.