futher fixes to bed12 logic and general bugs.  note some couts still there