encode.py now works