Refactored procedural worker code to classes