Added serialize() and merge() functions