merge elements with similar properties