refactor tictactoe