Examples improved.
Cleaned up duplicated code.
Encoding in protocol improved.