Decoding was wrong. Fixed by using persistent (shared-structure) arrays, and peeling back history.

Added a unit test that demonstrated the wrong behavior.