protected  PseudoSequencePair getLastInstanceOfPrefixSequenceNEW(List<Itemset> prefix, int i){
		
		int remainingToMatchFromPrefix = i;
		
		List<Position> listPositions = new ArrayList<Position>();
		
		int prefixItemsetPosition = prefix.size() -1;
		// for each itemset of sequence
		for(int j = size() -1; j>=0; j--){
			int itemInPrefixPosition = prefix.get(prefixItemsetPosition).size()-1;
			boolean allMatched = false;
			
			int searchedItem = prefix.get(prefixItemsetPosition).get(itemInPrefixPosition);
			
			List<Position> tempList = new ArrayList<Position>();
			// for each item in itemset
			for(int k=getSizeOfItemsetAt(j)-1; k >=0; k--) {
				int currentItem = getItemAtInItemsetAt(k, j);
				if(currentItem == searchedItem) {
					tempList.add(new Position(j, k));
					itemInPrefixPosition--;
					if(itemInPrefixPosition == -1 || tempList.size() == remainingToMatchFromPrefix) {
						allMatched = true;
						break;
					}
					searchedItem = prefix.get(prefixItemsetPosition).get(itemInPrefixPosition);
				}else if(currentItem < searchedItem) {
					break;
				}
			}
			if(allMatched) {
				remainingToMatchFromPrefix -= tempList.size();
				listPositions.addAll(tempList);
				prefixItemsetPosition--;
				if(prefixItemsetPosition == -1) {
					return new PseudoSequencePair(this, listPositions);
				}
			}
		}

		return null; // should not happen
	}