reorganization and minor tests