refactored code as per new service