Make use of some foreach loops