refactor r1