Add #to_query method