Improve test coverage and fix some bugs.

Mostly around decoding.  Thanks to "github.com/axw/gocov" for the help!