The ref function