function to return service object