Change struct worker duty and refactor codes