added maxValue and terminate to heuristics