Refactored .instances query method