Refactored out logic from RDefsAnalysis