queries: conditions refactoring & added OR support [closes #13]