public Bundle worthAtLeast(double maximumPrice) {
		double value = getValue();
		if (value < maximumPrice) return null;	//I want to cause null pointers if this ever happens.
		Bundle divvy = this.times(maximumPrice/value);	//good starting guess.
		Bundle leftover = this.minus(divvy);//What I have left to allocate.
		
		int n = 0;
		while(n < leftover.contents.size() && divvy.getValue() < maximumPrice){
			ResourcePile nth = leftover.getNthMostExpensive(n);
			if (divvy.getValue() + nth.getValue() < maximumPrice){
				divvy.insert(nth);
			}
			else{
				divvy.insert(new ResourcePile(nth.type,nth.amount*(City.economy.prices[nth.type.ordinal()]/(maximumPrice-divvy.getValue()))));
			}
			n++;
		}
		leftover = this.minus(divvy);//updated for stuffs shoved in.
		n = leftover.contents.size() - 1;
		while(n >= 0 && divvy.getValue() < maximumPrice){
			divvy.insert(leftover.getNthMostExpensive(n));//give it all leftovers until we have enough. Last ditch effort.
			n--;
		}
		if (divvy.getValue() < maximumPrice) return null;	//This should not be possible.

		extract(divvy);
		return divvy;
	}