RepositoryManager refactorings.

Some changes suggested in previous discussions.