Added unit tests, and reception of messages