tidy up debug messaging and prepare for adding code to send email report
commit