refactor getChar