Serious improvement to legality detection.