Including decoding in query.py

Draft. Not tested yet.