Fixed query problem. Added TEST_CASES