finished checkmate function