Initial implementation of dynamic query builder