Refactor 'run.py'