test encoding and decoding
add decoding, backwards compatible
document encoding and decoding
Merge pull request #1 from dominictarr/master

add encode and decode