Move some code from TimeGrid to Planner