This was doing stupid stuff, now it is a bit smarter.

This was doing really silly things by editing an array whilst that array was being mapped. Now it does it after it has finished the map.