Worker Distributed sample, refactored