Another round of code cleanup.
Merge branch 'dev' into test