Refactoring to support unicode.