Querying the tree, extractMin etc, and some cleanup