Another round of code clean-up; see individual commits for details