PRES-6370 Refactored code slightly to avoid bug introduced during minification when using an older version of the Closure Compiler