refactored worker to struct