Refactored set_l() and set_r().