adding writing of data array version