tests stubs
query tests + refactoring