fix minor bugs; add planner (incomplete)