Changed it to work with new json.
Added a check for the number of outcomes.