perfected querytest.js