Consolidated code from ClarityOneUpdater.ps1