Change method from each_with_index to each_line.with_index