Refactor clearRows()