Changed script to output 2d array