clean up
take in account the _type field in queries