Moved the row blank/empty detect to the correct location