private static Map<Integer, Double> getRankedTagList(BookmarkReader reader, Map<Integer, Double> userMap, double userDenomVal, 
			Map<Integer, Double> resMap, double resDenomVal, boolean sorting, boolean smoothing, boolean topicCreation) {
		
		Map<Integer, Double> resultMap = new LinkedHashMap<Integer, Double>();
		if (userMap != null) {
			for (Map.Entry<Integer, Double> entry : userMap.entrySet()) {
				resultMap.put(entry.getKey(), entry.getValue().doubleValue());
			}
		}
		if (resMap != null) {
			for (Map.Entry<Integer, Double> entry : resMap.entrySet()) {
				double resVal = entry.getValue().doubleValue();
				Double val = resultMap.get(entry.getKey());
				resultMap.put(entry.getKey(), val == null ? resVal : val.doubleValue() + resVal);
			}
		}
				
		if (sorting) {
			Map<Integer, Double> sortedResultMap = new TreeMap<Integer, Double>(new DoubleMapComparator(resultMap));
			sortedResultMap.putAll(resultMap);
			
			Map<Integer, Double> returnMap = new LinkedHashMap<Integer, Double>(MAX_RECOMMENDATIONS);
			int i = 0;
			for (Map.Entry<Integer, Double> entry : sortedResultMap.entrySet()) {
				if (i++ < MAX_RECOMMENDATIONS) {
					returnMap.put(entry.getKey(), entry.getValue());
				} else {
					break;
				}
			}
			return returnMap;
		}
		return resultMap;
		/*
		double size = (double)reader.getTagAssignmentsCount();
		double tagSize = (double)reader.getTags().size();
		Map<Integer, Double> resultMap = new LinkedHashMap<Integer, Double>();
		for (int i = 0; i < tagSize; i++) {
			double pt = (double)reader.getTagCounts().get(i) / size;
			Double userVal = 0.0;
			if (userMap != null && userMap.containsKey(i)) {
				userVal = userMap.get(i);//Math.exp(userMap.get(i)) / userDenomVal;
			}
			Double resVal = 0.0;
			if (resMap != null && resMap.containsKey(i)) {
				resVal = resMap.get(i);//Math.exp(resMap.get(i)) / resDenomVal;
			}
			if (userVal > 0.0 || resVal > 0.0) { // TODO
				if (smoothing) {
					resultMap.put(i, Utilities.getSmoothedTagValue(userVal, userDenomVal, resVal, resDenomVal, pt));
				} else {
					resultMap.put(i, userVal + resVal);
				}
			}
		}
		
		if (sorting) {
			Map<Integer, Double> sortedResultMap = new TreeMap<Integer, Double>(new DoubleMapComparator(resultMap));
			sortedResultMap.putAll(resultMap);
			if (topicCreation) {
				return sortedResultMap;
			} else { // otherwise filter
				Map<Integer, Double> returnMap = new LinkedHashMap<Integer, Double>(MAX_RECOMMENDATIONS);
				int i = 0;
				for (Map.Entry<Integer, Double> entry : sortedResultMap.entrySet()) {
					if (i++ < MAX_RECOMMENDATIONS) {
						returnMap.put(entry.getKey(), entry.getValue());
					} else {
						break;
					}
				}
				return returnMap;
			}
		}
		return resultMap;
		*/
	}