chapter11 && refactor