- added thread cleanup