Rework query

Most queries is now based its own struct.

 - fixes #19  
 - fixes #22