replaced for loops with Array.map method in step function
...
...