PyGlass thread related refactoring.