Tweak Performance by add "global ***" before each function call.