getting rid of globals