Change count back to forEach

Can not nest count loops inside other count loops:
https://community.bistudio.com/wiki/Code_Optimisation#forEach_vs_count
Merge pull request #1494 from ebaydayz/patch-4

Change count back to forEach