simplified code
implemented asynchronous sending of messages in both directions

closes #24