Clean up; add option to disable threshold updating for performance