refactoring and adding object test