updated using .each