minor changes, mainly refactorings for cleaner code in discovery service