Adding some thread functions
Changing void* to a class pointer
Changing void* to a class pointer
Fixing memory leak