Use map.with_index in #22
Solution for #54