Modifying the array merge method