Added codes to model. Changed registration ids to codes