added code for merging cluster results