add comments detailing what each function should do