Localize some top-level values
Add missing include
Draft the threshold analyses