Added unit tests, plus added special handling to the encoder and decoder
for lengths of zero.