changed some pseudo code in checkmate