Applied the ndenumerate function to loop thru arrays