Code Refactor for set character