Added transmitter functionality.
Fixed bugs in thread synchronization