Changed to using 1d array