added stuff to support the query of waiting time