Cleaned up some global variables to use local only.