updated code in run.py based on code review