More changes and re-organisation. This now compiles, but probably doesn't run...
Lots more changes, not runtime tested but most of the logic should be in place
Various changes to allow flagging of what behaviour we want etc. etc. etc.