Implement add_query