refactoring and clean-up part 6