Fixed GetANewThread method.
Implemented FreeThread method.