Documentation for part 2

Added comments describing what each part of the functions for part 2
do.