Added testing to queries