use namedtuple for querytime to make code simpler and more explicit