Consistent use of foreach