re-factored the service implementation part.