refactoring char arrays