Changed remaining MySQL queries to threaded ones