moved query stuff into an indipenden class that mimics more sql syntax