Code cleanup and fix for CAAERS-6994.
Merge branch 'master' of https://github.com/NCIP/caaers
merging with local changes.