Refactor from service discovery project