basic $ref implementation