Converted 2D prices array into 1D array, modified code to deal with it