Is it not possible to use map here instead of each?