merging algo changed