adding debug statements and enabling debug logging