Refactor "instance exists" check