(the work was first done in the RELENG_4 branch near a release during a MFC to make the code cleaner and more consistent)