Cleanup of detection code for file-level directives