cleaned up worker code with modules