Moved to using references for arrays