Cornering for the quickest laps means learning and planning