protected void normalizeProbabiltiesAndUpdateModel() {
		for (int stateFrom = 0; stateFrom < numStates; ++stateFrom) {
			// Initial state probabilities.
			if (normFactorInitialState > 0.0)
				model.probInitialState[stateFrom] = probInitialStateNew
						.get(stateFrom) / normFactorInitialState;
			else
				model.probInitialState[stateFrom] = 0.0;

			// Transition probabilities.
			if (normFactorTransition[stateFrom] > 0.0)
				for (int stateTo = 0; stateTo < numStates; ++stateTo)
					model.probTransition[stateFrom][stateTo] = probTransitionNew
							.get(stateFrom).get(stateTo)
							/ normFactorTransition[stateFrom];
			else
				for (int stateTo = 0; stateTo < numStates; ++stateTo)
					model.probTransition[stateFrom][stateTo] = 0.0;

			// Emission probabilities.
			HashMap<Integer, Double> emissionMapNew = probEmissionNew
					.get(stateFrom);
			if (normFactorEmission[stateFrom] > 0.0)
				for (Entry<Integer, Double> emission : emissionMapNew
						.entrySet())
					emission.setValue(emission.getValue()
							/ normFactorEmission[stateFrom]);
			else
				for (Entry<Integer, Double> emission : emissionMapNew
						.entrySet())
					emission.setValue(0.0);

			// Change the model emission map by the new emission map.
			model.probEmission.set(stateFrom, emissionMapNew);
		}
	}