refactoring Str class