modified hardware.py