added code sample of chapter5 part 1