Implement listener for Queries