Arbitrary acts of kindness

Some general TODO squashing and code tidying.

See individual commits for details.