partial work on the sparse_rw function