all these variables will become globals if not careful; they should be wrapped.