Refactor 'merge sorted arrays'.