do not pass 2nd array by reference to avoid corruption of that array for future reference