Move id out of meds loop