Changes help clean up resources used by thread