trying to eliminate globals