debug 12/01

Separate phase 3 from gen_plan().
Add debugging messages.