add code_ref method