Completed implementation of part 3 of assignment.