Added DTC logging, and moved DTC queries to the loop