many updates

some minor refactoring