worker demo refactoring