An implantable medical device, comprising: a pulse generator for delivering pacing pulses; at least one implanted electrode (20, 22) in electrical communication with the pulse generator for delivering the pacing pulses to cardiac tissue; at least one implanted electrode (28, 30) to sense capture in response to the delivery of the pacing pulses; a microprocessor configured to control the pulse generator, acquire sensed data from the at least one implanted electrode(s), wherein the sensed data includes a set of determined capture thresholds for a plurality of occurrences of the electrode(s) sensing capture; memory for storing said determined capture thresholds; and wherein the microprocessor is further configured to determine a historical variability from the set of determined capture thresholds and set a safety margin based on the historical variability of the set of determined capture thresholds, and to determine a pacing pulse level based on the set safety margin for use in subsequently pacing the chamber of the patient's heart at the pulse level; wherein the historical variability of the set of determined capture thresholds comprise a rolling maximum and a rolling minimum of the measured threshold over a time period; wherein the microprocessor is configured to determine a difference in amplitude between the rolling maximum and the rolling minimum; wherein the microprocessor is configured to: set the safety margin to 0.5V above a last measured threshold if the difference in amplitude between the rolling maximum and the rolling minimum was less than 0.5 V; set the safety margin to 1.0V when the difference in amplitude between the rolling maximum and the rolling minimum was ≥0.5V but less than 1.0V; and set the safety margin set to 1.5V when a difference between the difference in amplitude between the rolling maximum and the rolling minimum was ≥1.0V. a pulse generator for delivering pacing pulses; at least one implanted electrode (20, 22) in electrical communication with the pulse generator for delivering the pacing pulses to cardiac tissue; at least one implanted electrode (28, 30) to sense capture in response to the delivery of the pacing pulses; a microprocessor configured to control the pulse generator, acquire sensed data from the at least one implanted electrode(s), wherein the sensed data includes a set of determined capture thresholds for a plurality of occurrences of the electrode(s) sensing capture; memory for storing said determined capture thresholds; and wherein the microprocessor is further configured to determine a historical variability from the set of determined capture thresholds and set a safety margin based on the historical variability of the set of determined capture thresholds, and to determine a pacing pulse level based on the set safety margin for use in subsequently pacing the chamber of the patient's heart at the pulse level; wherein the historical variability of the set of determined capture thresholds comprise a rolling maximum and a rolling minimum of the measured threshold over a time period; wherein the microprocessor is configured to determine a difference in amplitude between the rolling maximum and the rolling minimum; wherein the microprocessor is configured to: set the safety margin to 0.5V above a last measured threshold if the difference in amplitude between the rolling maximum and the rolling minimum was less than 0.5 V; set the safety margin to 1.0V when the difference in amplitude between the rolling maximum and the rolling minimum was ≥0.5V but less than 1.0V; and set the safety margin set to 1.5V when a difference between the difference in amplitude between the rolling maximum and the rolling minimum was ≥1.0V. set the safety margin to 0.5V above a last measured threshold if the difference in amplitude between the rolling maximum and the rolling minimum was less than 0.5 V; set the safety margin to 1.0V when the difference in amplitude between the rolling maximum and the rolling minimum was ≥0.5V but less than 1.0V; and set the safety margin set to 1.5V when a difference between the difference in amplitude between the rolling maximum and the rolling minimum was ≥1.0V.