That approach should allow you to remove the `each_with_index` loop too.