updated merging with index