Fix encoding and decoding of dict types
Protocol done, refactored bunch of code, start_server fun implemented.