added comments to code to help myself remember what each part does