added new class to control inter-thread communication, added more asserts