Added a between option to subarray, improved merge