Port this to sign.py too