implemented merge()