Added correct implementation of determining checkmate