notes on what each function is doing