Remove unnecessary global variables

Implements #1, credits to @itchyny.