move queries out of wiki.py