added comments explaining what each function and variable declaration is doing