basic reorganization plus some cleanup as a prelude to deep hacking