[IMP]planner: clean some code and put some docstring.