cleanup row fitting

need better separation of logic for sort order sensitive code