Update relay.py

I updated this to be much better :)