finished proof of stuff, working on runtime of the query algorithm.