added a loop to make residue range changes easier