merge common code