uses built-in map with_index