Added a check for check and checkmate.