refactored tictactoe