refactor in chapter-specific files