Added the planner function