queries: added support for nested conditions [closes #14]