chapter refactoring