some reorganization and a few changes
more clean-up