Basic functionality for the querying operation