Remove global variable ugliness