changing each to each_with_index on shovel loop