method createDemandFromSettings rewritten using a more general approach, unit test edited