Modularise

Merge in progress from the modularise branch