cleaning and merging