optimize checkmate