Merge op improvements

Not as perfect as I'd like, but far better than it was -- especially in terms of code re-use/conflicts between merge and gather. There are also a few bug fixes and performance improvements. Additional improvements can wait for a larger scale function api redux, but at least from here it will be very straightforward to add a few additional merge ops (thinking cardinality or a generic boxed sub query op wrapper).