removed global variables. Why did I do that?