Adding planner function