fixed a whole slew of problems by making everything a global variable and hoping no one notices.