reworked parseDemand() to use a dictionary