CON-1447: Code refactor and cleanup