Adding function of merging of voids according to boundary thresholds