Do terminal recognition first