We moved some of the loops into functions so that we can do the transition on the new type easier without copying the same code over again. Verification still pending
Included the choice of <con> type. Many things have to change as the permited location of <con> for example