modified the recalculate_adherence script