Refactor character attribute assignment