Refactor ValidGlobalNameSniff

Change-Id: Ia198a09312bdf6cde44ec1adc36445f7f2be148e