refactored string mod