refactored ratnum