More cleanup

See commit messages for a list of changes.