Fixed bugs in query constructions. Added filter functions, based on dictionaries.