Reorganization and fixes