Added unordered case
Added indices
Added missing import