Swap order of indices in output