Working on chapter6 and 8