refactor halfword