refactored query checking into '' and 'Condition'