added d-d intervals to the error function