added package for chapter2 and refactored chapter 1