Made a few query validity tests more readable