update codes and index