Row sorting works (apparently)
slightly less stupid arithmetic