Added the ForEach extension method to IEnumerable and made use of it in the rest of the code.