The purpose of this study is to determine if the medication lofexidine, taken together with buprenorphine or methadone, is more effective at reducing opiate craving, use and stress response than buprenorphine or methadone alone, and to see if this effect is different for men and women. Participants are randomly assigned to add either lofexidine or placebo to their buprenorphine treatment for five weeks. They return at the end of five weeks to participate in a stress task. Throughout the study, participants complete "CREMA" sessions (Cue Reactivity Ecologic Momentary Assessment) three times a day. These sessions include looking at stressful and neutral pictures and rating stress and craving.