Eliminate all global variables

And probably break all kinds of shit