refactored tic tac toe