Wrap this in a closure so these variables don't leak globally