First step of refactoring

Query class introduced. Does not change API at all. Just in order to kill huge and complex API#search method.
There are some things for you to test :)
Going forward, want to remove Helpers and simplify Query stuff. Many useless things found.