Apologies this is a simplified version of the code I made to post here (i.e I deleted a lot of the manipulation of the data that happens after the array as this is not relevant) I have changed the code now.
Apologies this is a simplified version of the code I made to post here (i.e I deleted a lot of the manipulation of the data that happens after the array as this is not relevant) I have changed the code now.