Allows custom array sorting. Fixes tessel/beta#440