refactored rs