Secondary outcome measures: To determine the feasibility and acceptability of using (1) the Daysimeter/Dimesimeter and Actigraph to collect real-time field data on light exposure and its impact on circadian rhythms, and (2) the Autosense to collect real-time field data on physiological function. Also, to (3) combine Daysimeter/Dimesimeter data with electronic-diary data to determine whether heroin/cocaine users experience circadian disruption and, if so, how this disruption is related to psychosocial stress and illicit drug use, (4) combine Autosense data with electronic-diary data to determine if physiological responses to triggers can be used to inform drug relapse prevention efforts, (5) To determine the feasibility and acceptability of interactive mHIVRR software programs to deliver counseling and HIV education, and to determine whether they reduce HIV-related risk via increased HIV/STD knowledge, (6) to determine if the HPA axis is normal after at least 3 months of opioid agonist treatment, (7) to incorporate genetic characteristics as predictors of EMA and GMA data and other behavioral measures, (8) to assess how objectively measured sleep quality is associated with EMA-reported psychosocial stress and reward responsiveness, and with geographical exposure to stressful and rewarding environments, (9) to determine the feasibility of using a more up-to-date EMA interface and device, and to examine the relationship between opioid withdrawal symptoms and successful taper from methadone or buprenorphine maintenance and (10) to obtain qualitative data on participants perceptions of their environments, in order to inform future work and to help explain why participants seem to do better in more disordered environments.