modify pair so it doesn't depend on array