Only way I could get it to properly populate the array, without the last set its empty when it goes into the for each.