Refactor and fix local tic-tac-toe