diff --git a/tconfpy.py b/tconfpy.py
index e96be5a..ceae2d8 100755
--- a/tconfpy.py
+++ b/tconfpy.py
@@ -6,7 +6,7 @@
 # Program Information
 
 PROGNAME = "tconfpy"
-RCSID = "$Id: tconfpy.py,v 1.165 2004/04/08 17:11:09 tundra Exp $"
+RCSID = "$Id: tconfpy.py,v 1.166 2004/04/08 22:46:52 tundra Exp $"
 VERSION = RCSID.split()[2]
 
 # Copyright Information
@@ -107,13 +107,12 @@
 
 # Regular Expressions
 
-reVARWHITE   = r".*\s+.*"
-reVARILLEGAL = r"\%s(%s)%s" % (DELIML, reVARWHITE,  DELIMR)  # Variable reference with spaces in it
-reVARREF     = r"\%s.+?\%s" % (DELIML, DELIMR)            # Variable reference
+reVARWHITE    = r".*\s+.*"                         # Look for embedded whitespace
+reVARREF      = r"\%s.+?\%s" % (DELIML, DELIMR)    # Variable reference
 
-VarWhite     = re.compile(reVARWHITE)
-VarIllegal   = re.compile(reVARILLEGAL)
-VarRef       = re.compile(reVARREF)
+VarWhite      = re.compile(reVARWHITE)
+VarRef        = re.compile(reVARREF)
+
 
 
 ###########
@@ -298,18 +297,19 @@
 Messages["eENDIFMISS"]    = FILENUM + "Missing %d" + " '%s' " % ENDIF + " Statement(s)"
 Messages["eEQUIVEXTRA"]   = FILENUM + "Only a single '%s' Or '%s' Operator Permitted" % (EQUIV, NOTEQUIV)
 Messages["eIFEXTRATXT"]   = FILENUM + "Extra Text On Line.  '%s' Only Accepts Variable References As Arguments"
-Messages["eNOTLEGALVAL"]  = FILENUM + "'%s' Not Found In List Of Legal Values For Variable '%s'"
 Messages["eNAMESPACENEW"] = FILENUM + "New Namespace Creation Not Permitted. Current Namespace Unchanged: '%s'"
+Messages["eNOTLEGALVAL"]  = FILENUM + "'%s' Not Found In List Of Legal Values For Variable '%s'"
 Messages["eSTRINGLONG"]   = FILENUM + "Right-Hand-Side Too Long.  '%s' Must Be No More Than %s Characters Long"
 Messages["eSTRINGSHORT"]  = FILENUM + "Right-Hand-Side Too Short. '%s' Must Be At Least %s Characters Long"
 Messages["eTYPEBAD"]      = FILENUM + "Type Mismatch. '%s' Must Be Assigned Values Of Type %s Only"
 Messages["eVALLARGE"]     = FILENUM + "%s Is Larger Than The Maximum Allowed, %s, For Variable '%s'"
 Messages["eVALSMALL"]     = FILENUM + "%s Is Smaller Than The Minimum Allowed, %s, For Variable '%s'"
-Messages["eVARRESERVED"]  = FILENUM + "Variable Name Cannot Begin With The '%s' Symbol"
 Messages["eVARNAMESPC"]   = FILENUM + "Variable Names May Not Contain Whitespace"
 Messages["eVARNEW"]       = FILENUM + "New Variable Creation Not Permitted"
 Messages["eVARNONAME"]    = FILENUM + "Variable Name Evaluates To Null String.  Not Permitted"
 Messages["eVARREADONLY"]  = FILENUM + "Variable '%s' Is Read-Only.  Cannot Change Its Value"
+Messages["eVARREFNEST"]   = FILENUM + "Nested Variable References Are Not Permitted"
+Messages["eVARRESERVED"]  = FILENUM + "Variable Name Cannot Begin With The '%s' Symbol"
 Messages["eVARUNDEF"]     = FILENUM + "Attempt To Reference Undefined Variable '%s'"
 
 
@@ -587,6 +587,25 @@
 
         sym = var[1:-1]   # Strip delimiters
 
+        # Do some preliminary tests to validate variable names
+        
+        # Make sure there is no whitespace in the variable reference
+
+        if VarWhite.match(sym):
+            ErrorMsg("eVARNAMESPC", (cfgfile, linenum))
+            ref_ok = False
+
+        # Look for evidence of attempts to nest variable references
+
+        if sym.count(DELIML) or sym.count(DELIMR):
+            ErrorMsg("eVARREFNEST", (cfgfile, linenum))
+            ref_ok = False
+            
+        # If Preliminary tests found errors - quit now
+        
+        if not ref_ok:
+            return line, ref_ok
+        
         # By default, all variable names assumed to be relative to
         # current namespace context unless escaped with NSSEP
         
@@ -1031,16 +1050,14 @@
                 DebugMsg("dLINEIGNORE", (cfgfile, linenum, orig, dNOTINCLUDE))
             return
 
-        # Catch attempts to  use whitespace within variable names or references
-
-        if VarIllegal.findall(line) or VarWhite.findall(line.split(EQUAL)[0].strip()):
-            ErrorMsg("eVARNAMESPC", (cfgfile, linenum))
-            return
-
         # Catch attempts to dereference without name
 
         if line.count(DELIML + DELIMR):
             ErrorMsg("eVARNONAME", (cfgfile, linenum))
+
+            if DEBUG:
+                DebugMsg("dPARSEDLINE", (cfgfile, linenum, orig, line))
+
             return
         
         # Do any necessary variable dereferencing
@@ -1055,9 +1072,14 @@
             r = line[e+1:].strip()
 
 
+            # Make sure the variable name has no spaces in it
+
+            if VarWhite.match(l):
+                ErrorMsg("eVARNAMESPC", (cfgfile, linenum))
+
             # Suppress attempts to set null-named variables
 
-            if not l:
+            elif not l:
                 ErrorMsg("eVARNONAME", (cfgfile, linenum))
                     
             # Suppress attempts to set variables named starting