factor ensure and generate into aux and also work on traverse.