Various refactorings to the service structure. Fixed some logging issues.