Added asserts to available functions to catch faults in logic.
Improved efficiency of multithreading unit test.