Changes as requested by @cpeterso.

Moved the code to a separate public method, controllable during execution by the relevant piece of code, depending on context.