Added query structure and doxygen comments