switch to pointer based 2d array