made set_r() more readable