extract service running logic to a class