New planner timing working. Warning, a lot of debug code in here!