public int compareToNumbers(double n1, double n2, String name1, String name2, boolean descending) {
		int order = (descending ? -1 : 1);

		// Both are NaN => compare strings (always in alphabetical order)
		if (Double.isNaN(n1) && Double.isNaN(n2)) { return name1.compareTo(name2); }

		// One of them is NaN? (when sorted, push them to the end of the list)
		if (Double.isNaN(n1)) return +1;
		if (Double.isNaN(n2)) return -1;

		// Both are 'normal' numbers, just compare them
		if (n1 < n2) return -1 * order;
		if (n1 > n2) return +1 + order;

		// If both numbers are equal, sort by 'name'
		return name1.compareTo(name2);
	}