added the first part of part 3 code