Made the clean-up method non-intrusive, added thread test.