Remove unnecessary rows