Fix for #4938. This change makes the reference manager public and documented so that it can be replaced.