refactor weiqi