Added send and receive mechanism.
Cleanup code.