added debug() for outputting queries