Refactor string to char array