refactoring and cleanup

no significant changes are included.