First implementation of encoding and decoding of messages.
This can, and most likely will, contain a lot of errors.