refactor array merge