mid-term sort codes and add comments