added untested reactive decision making code