Adding query functionality to all the end points