Added string res values and refactored.