Clean up stalemate code a bit