getting rid of more globals