-improved syntax checking script
-simplified a function