Create ref() function.