Use Object.keys() with forEach() to iterate.

This consollidates the code and uses less variables. Stick to using
native for loop when looping through regular arrays however.
Use Object.keys() with forEach() to iterate.

This consollidates the code and uses less variables. Stick to usiing
native for loop when looping through regular arrays however.