added logical to choose between dt or qt tables
added some if statements to choose between qt and dt