Misc reorganization and bug fixes.