Fix MerkleCollapse

Screwed up some of the bit math, and didn't write any tests.

Both of those have been fixed, along with some other stuff that's just bonus material