Loop to find length for new array, then populate