code cleanup, moved global vars under 1 global object