Use closures to keep globals clean.