Refactor tictactoe