Rr refactor code