Refactor code that checks if url represents an instance.