reindexing works! it was a matter of redefining k as the cell counter