added some broad comments to split up the code.