implement new Query class