Changes according Dominic's review notes:
- use forEach function instead of for() loops
- code formatting