Replaced query method.