Added functions to convert between index <--> row,col