refactored runner.py