Castling logic updated