First version of merge voices function (but crash appears sometimes)