changed R to S registers