Implemented query()