Rectify and sort