More shuffling of code. Implemented all sorting in terms of a new builtin `TupleSortwith`.