now using the faster db query function