Some further code cleanup.
Merge branch 'dev' into test