merge merkle tree

- adding  PR for comments
more erlangish to return {error, Reason} here rather than a new 3 tuple.