add check to see which type of ref was provided