[MOD] Refactoring static variables and functions.

Fixes public/private declarations and variables leaking into other
modules.