Actually there is a problem here -- when you specify a key function, it should only be used for sorting, it should not be returned in the final output. So this code for example should return
```
[10, 9, 7, 6, 5, 4]
```
You probably need to make a pass after the merge if a key is given to create a new array.