rewrote some pseudocode in half of checkmate