added merge, serialization methods and more tests