changed output to 2d array