refactored vector and beginning of chapter 2