private String computeMaxInfoGain(Instances instances,
			List<String> attributes, List<String> attributesTested) {
		// get list of attributes
		String[] attribute = attributes.toArray(new String[attributes.size()]);
		// initialize
		int maxIndex = -1;
		double maxInfoGain = -1;
		// compute maximum information gain across all attributes
		for (int i = 0; i < attributes.size(); i++) {
			if (attributesTested == null
					|| !attributesTested.contains(attribute[i])) {
				log.info("Computing info gain for attribute " + attribute[i]);
				double infoGain = computeInfoGain(instances, attribute[i]);
				if (infoGain > maxInfoGain) {
					maxInfoGain = infoGain;
					maxIndex = i;
				}
			}
		}
		if (maxIndex >= 0) {
			log.info("Computed max info gain " + maxInfoGain + " on "
					+ attribute[maxIndex]);
		} else {
			log.info("Computed max info gain error");
		}

		// TODO: Check this logic, if the maxIndex was not identified, then
		// split on the first attribute.
		// This is a temp fix, the reason why this condition would occur needs
		// to be looked at
		return maxIndex >= 0 ? attribute[maxIndex] : attribute[0];
	}