added part 3 code at end of main