Added illegal move check