refactoring for ch10 exercises complete