Plot hole: About two thirds of the way through this episode, Data deduces how Moriarty was able to 'leave' the holodeck. The big reveal is that he never did leave the holodeck, he merely reprogrammed it to simulate the rest of the ship without Picard, Barclay or Data's knowledge. While it is believable that this would fool humans like Picard and Barclay, it is ludicrous to suggest that Data would be taken in by it, even for a second. Data is an android whose perceptions of sight, sound and the world around him are far more sophisticated than humans. To list what we know of Data's perceptive abilities from previous episodes would take up the entire page, but suffice it to say he should have immediately recognised the 'Enterprise' as force fields and holograms rather than the genuine article. Note: this goes beyond a 'character mistake' or anything like that. Data's enthusiasm for Sherlock Holmes style deduction should have led him to eliminate the impossible before considering what was probable. Data accepts the impossibility of a holodeck character existing is the real world before discounting the possibility that it was still a holodeck simulation. This contradicts an awful lot of what is known about Data's abilities and powers of deduction. Although it serves for a good mystery the fact is it takes Data far longer than it should to deduce, or even guess at, the truth of their situation.