merkle: added functions of live streaming.
merkle: corrected test case.
merkle: improved code according to commments. tested using dialyser