rough implementation of 2d array writing