some reorganization and deletions of deprecated code