each_with_index makes it more concise