add some comments, do sorting only once when building completion tree.