Move RState to separate class