added some comments to help organize code