refactoring / breaking up worker.py a little