code cleaning of exercise 1 chapter 3