A device for controlling an electrosurgical waveform includes the initial steps of activating an electrosurgical generator and increasing power during a first sample window and determining a direction of change in a first average impedance during the first sample window. The device controller also includes the steps of performing a first adjustment of power in response to the direction of change in the first average impedance during a subsequent sample window and determining a direction of change in a subsequent average impedance during the subsequent sample window in response to the first adjustment of power. The device controller also includes performing a subsequent adjustment of power in response to the direction of change in the subsequent average impedance, wherein the subsequent adjustment of power is reverse to that of the first adjustment of power when the direction of change in the first and subsequent average impedances is the same.