Finished initial do4
Tree works for r <= 4.  Not sure why it isn't working above that.
still tiny bug.  file is writing correctly, decoding is not going well
option 3 finally finished, produces correct output
fixing decoder... encode should be fine.
option 4 all complete and tested, ready to be pulled in
Merge master/master