Adding revised logging code and removing Trace statements