used each instead of for loop