Modified code for arrays to hopefully fix a bug.