refactor ref and url