first naive implementation of own protocol encode and decode finished