Added code to enable debug mode and priting of all queries