Refactor ref() for clarity