Make LOG_QUERIES a tinnnyyyy bit less hacky