Added comments

Added comments explaining what each function does.