Just some random debugging and query rewriting.