Implemented responding to queries