Added function comments

Added function comments describing what each function does to increase readability.