Add query creation algorithms