Enhancing threading and driver cleanup