Clean up and removed global variables