Implement query method.