Changed variable references to reference new arrays instead.