added parameters for query and interval