Unswitching loops for fun and profit

Duplicating loops around can yield some decent optimisations