Added custom manager and added stalemate detection.