Remove reliance on saving number of rows