Fixing globals being exposed from closure