Numerous fixes and changes.

Pushing now to get back into more discrete and recognisable commits.