Dear Mike,
well, that looks similar to my script, I've written and published last year.
My proposal deals with the STF process. STF schould perform the steps STF, apply to histogram, deactivate and apply histogram to view in one cycle.
Regards
Hartmut