Make scripts pass when run consecutively.

-- Don't use class methods.
-- Misc other tidyup.