Two simple functions to convert scrap->ref or ref->scrap