robot.py code cleanup