Minor fixes and tidy-up.
Merge branch 'lib_update' into api_integration