Change push_back/sort to lower_bound/insert